<?php

if(isset($_GET['id']))
{
  $id = $_GET['id'];
  $mysql = mysql_connect("localhost", "root", "kGbN85Z");
  mysql_query("USE ftp;");

  $res=mysql_query("SELECT image FROM films WHERE kp_id=".addslashes($id).";") or die();
  if(!mysql_num_rows($res)) die();
  $image=mysql_result($res, 0, 0);
  header("Content-type: image/gif");  
  echo $image;
  mysql_close($mysql);
}

?>
